package com.cc.blog.web.service.impl;

import com.cc.blog.admin.mapper.BlogSettingsMapper;
import com.cc.blog.admin.model.BlogSettingsDO;
import com.cc.blog.common.utils.Result;
import com.cc.blog.web.convert.BlogSettingsConvert;
import com.cc.blog.web.domain.vo.FindBlogSettingsDetailRspVO;
import com.cc.blog.web.service.BlogSettingsService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @Author cc
 * @Date 2024/7/12 11:00
 */
@Service
@Slf4j
@AllArgsConstructor
public class BlogSettingsServiceImpl implements BlogSettingsService {

    private final BlogSettingsMapper blogSettingsMapper;

    @Override
    public Result findDetail() {
        // 查询博客设置信息（约定的 ID 为 1）
        BlogSettingsDO blogSettingsDO = blogSettingsMapper.selectById(1L);
        // DO 转 VO
        FindBlogSettingsDetailRspVO vo = BlogSettingsConvert.INSTANCE.convertDO2VO(blogSettingsDO);
        return Result.success(vo);
    }
}
